<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>测试助手</title>
@include('common-css')
<style>
.app-container {
    padding: 10px;
}

h1 {
    font-size: 20px;
}

</style>
</head>
<body>

<div id="app"></div>

<script id="appTemplate" type="x-template">
<div class="app-container">

    <h1>测试助手({{ \Illuminate\Support\Facades\App::environment() }})</h1>

    <main style="margin-top: 20px;">
        <a-button style="margin-bottom: 10px;" type="primary" @click="performAction('检查运行环境')">检查运行环境</a-button>
        <div>
            <select v-model="largeGroupId">
                <option value="1">路基路面组</option>
                <option value="2">桥涵组</option>
                <option value="3">隧道及地下工程组</option>
                <option value="4">综合组</option>
                <option value="5">科技人物组</option>
            </select>
        </div>

        <div style="margin-top: 8px;">
            <a-button type="primary" @click="performAction('重置到形式审查阶段')">重置到形式审查阶段</a-button>
        </div>

        <div style="margin-top: 8px;">
            <a-button type="primary" @click="performAction('自动完成形式审查')">自动完成形式审查</a-button>
        </div>

        <div style="margin-top: 20px;">
            <a-button type="primary" @click="performAction('重置到分配评审阶段')">重置到分配评审阶段</a-button>
        </div>

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('重置到网评待组长审核状态')">重置到网评待组长审核状态</a-button>--}}
        {{--</div>--}}

        <div style="margin-top: 8px;">
            <a-button type="primary" @click="performAction('自动进行专家评审')">自动进行专家评审</a-button>
        </div>

        <div style="margin-top: 8px;">
            <a-button type="primary" @click="performAction('提交所有专家的评审结果')">提交所有专家的评审结果</a-button>
        </div>

        <div style="margin-top: 8px;">
            <a-button type="primary" @click="performAction('自动填充专家组回避关键字')">自动填充专家组回避关键字</a-button>
        </div>

        <div style="margin-top: 8px;">
            <a-button type="primary" @click="performAction('自动设置所有专家能够参与评审')">自动设置所有专家能够参与评审</a-button>
        </div>

        {{--该功能有BUG，所以注释掉--}}
        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('重置到网评阶段')">重置到网评阶段</a-button>--}}
        {{--</div>--}}

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('填充并提交专家评分')">填充并提交专家评分</a-button>--}}
        {{--</div>--}}

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('大组长审核专家评分')">大组长审核专家评分</a-button>--}}
        {{--</div>--}}

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('委员待定区投票')">委员待定区投票</a-button>--}}
        {{--</div>--}}

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('委员投票')">委员投票</a-button>--}}
        {{--</div>--}}

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('选择答辩项目')">选择答辩项目</a-button>--}}
        {{--</div>--}}

        {{--<div style="margin-top: 8px;">--}}
            {{--<a-button type="primary" @click="performAction('录入答辩结果')">录入答辩结果</a-button>--}}
        {{--</div>--}}

    </main>


</div>
</script>

@include('common-js')

<script>
var app = new Vue({
    el: '#app',
    template: '#appTemplate',
    data: {
        largeGroupId: '1',
    },
    mounted() {
    },
    methods: {
        performAction(action) {
            if ((action !== '检查运行环境') && !confirm('操作确认：' + action + '？')) {
                return
            }
            axios.post('/api/test/helper', {
                action: action,
                large_group_id: this.largeGroupId,
            })
                .then(response => {
                    if (action === '检查运行环境') {
                        info(response.data.msg)
                    } else if (response.data.ok) {
                        success('操作成功')
                    } else {
                        error(('操作失败: ' + response.data.msg))
                    }
                })
        }
    },
})
</script>

</body>
</html>